# -*- coding: utf-8 -*-
__author__ = 'vladbranzei'

from pymongo import MongoClient

class DBConnector(object):
    host = port = db = client = collection = None

    def __init__(self, i_collection, i_host='localhost', i_port=27017, i_db='freya'):
        self.host = i_host
        self.port = i_port
        self.db = i_db
        self.collection = i_collection
        self._create_connection()

    def _create_connection(self):
        self.client = MongoClient(self.host, self.port)
        self.db = self.client[self.db]
        self.collection = self.db[self.collection]